#include<cstdio>
#include<cstring>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline LL read()
{
	LL x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=2e5+10;
int pri[MAXN],mu[MAXN],tot;
bool ispri[MAXN];
void cal_prime_mu()
{
	mu[1]=1;
	for(int i=2;i<=int(2e5);++i)
	{
		if(!ispri[i])
		{
			pri[++tot]=i;
			mu[i]=-1;
		}
		for(int j=1;j<=tot&&i*pri[j]<=int(2e5);++j)
		{
			ispri[i*pri[j]]=true;
			if(i%pri[j]==0)
			{
				mu[i*pri[j]]=0;
				break;
			}
			mu[i*pri[j]]=-mu[i];
		}
	}
	return;
}
LL cal(LL x)
{
	LL ret=0;
	for(LL i=1;i*i<=x;++i)
		ret+=(x/(i*i))*mu[i];
	return x-ret;
}
int main()
{
	cal_prime_mu();
	LL k=read();
	LL l=1,r=k<<2;
	while(l<=r)
	{
		LL mid=(l+r)>>1;
		if(cal(mid)<k)l=mid+1;
		else r=mid-1;
	}
	printf("%lld\n",l);
	return 0;
}
